import VueRouter from 'vue-router';


const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}
const routes = [
    {
        path: '/',
        name: 'access',
        component: () => import('../components/access.vue'),
    },
    {
        path: '/managerLogin',
        name: 'managerLogin',
        component: () => import('../components/manager/LOGIN/ManagerLogin.vue'),
    },
    {
        path: '/workspace',
        name: 'workspace',
        component: () => import('../components/manager/WORKSPACE/Index.vue'),
        children: [
            {
                path: '/managerMain',
                name: 'managerMain',
                component: () => import('../components/manager/WORKSPACE/Main.vue'),
            },
            {
                path: '/userData',
                name: 'userData',
                meta:{
                    title: '首页',
                },
                component: () => import('../components/manager/WORKSPACE/UserData.vue'),
            },
            {
                path: '/managerData',
                name: 'managerData',
                meta:{
                    title: '首页',
                },
                component: () => import('../components/manager/WORKSPACE/ManagerData.vue'),
            },
            {
                path: '/goodsData',
                name: 'goodsData',
                meta:{
                    title: '首页',
                },
                component: () => import('../components/manager/WORKSPACE/GoodsData.vue'),
            },
            {
                path: '/orderData',
                name: 'orderData',
                meta:{
                    title: '首页',
                },
                component: () => import('../components/manager/WORKSPACE/OrderData.vue'),
            },
            {
                path: '/unorderData',
                name: 'unorderData',
                meta:{
                    title: '首页',
                },
                component: () => import('../components/manager/WORKSPACE/UnorderData.vue'),
            },
            {
                path: '/browseData',
                name: 'browseData',
                meta:{
                    title: '首页',
                },
                component: () => import('../components/manager/WORKSPACE/BrowseData.vue'),
            },
        ]
    },
    {
        path: '/managerHome',
        name: 'managerHome',
        component: () => import('../components/manager/HOME/Home.vue'),
    },
    {
        path: '/userSignup',
        name: 'userSignup',
        component: () => import('../components/user/SIGNUP/UserSignup.vue'),
    },
    {
        path: '/userLogin',
        name: 'userLogin',
        component: () => import('../components/user/LOGIN/UserLogin.vue'),
    },
    {
        path: '/shopping',
        name: 'shopping',
        component: () => import('../components/user/SHOPPING/Index.vue'),
        children: [
            {
                path: '/main',
                name: 'main',
                component: () => import('../components/user/SHOPPING/Main.vue'),
            },
            {
                path: '/shoppingCenter',
                name: 'shoppingCenter',
                component: () => import('../components/user/SHOPPING/GoodsData.vue'),
            },
            {
                path: '/cart',
                name: 'cart',
                component: () => import('../components/user/SHOPPING/Cart.vue'),
            },
            {
                path: '/myOrders',
                name: 'myOrders',
                component: () => import('../components/user/SHOPPING/Order.vue'),
            },
            {
                path: '/addBalance',
                name: 'addBalance',
                component: () => import('../components/user/SHOPPING/AddBalance.vue'),
            },
        ]
    },
    {
        path: '/userHome',
        name: 'userHome',
        component: () => import('../components/user/HOME/Home.vue'),
    }
]
const router=new VueRouter({
    mode:'history',
    routes
})

export default router;